home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Workbench Add-On
/
Workbench Add-On - Volume 1.iso
/
Dev
/
Oberon
/
source
/
amiga
/
Config.mod
< prev
next >
Wrap
Text File
|
1995-06-29
|
13KB
|
355 lines
(***************************************************************************
$RCSfile: Config.mod $
Description: Interface to expansion.library
Created by: fjc (Frank Copeland)
$Revision: 3.8 $
$Author: fjc $
$Date: 1995/06/04 23:13:14 $
Includes Release 40.15
(C) Copyright 1985-1993 Commodore-Amiga, Inc.
All Rights Reserved
Oberon-A interface Copyright © 1994-1995, Frank Copeland.
This file is part of the Oberon-A Interface.
See Oberon-A.doc for conditions of use and distribution.
***************************************************************************)
<* STANDARD- *>
MODULE [2] Config;
IMPORT e := Exec, s := Sets;
(*
** $VER: configregs.h 36.13 (15.2.91)
**
** AutoConfig (tm) hardware register and bit definitions
*)
(*
** AutoConfig (tm) boards each contain a 32 byte "ExpansionRom" area that is
** read by the system software at configuration time. Configuration of each
** board starts when the ConfigIn* signal is passed from the previous board
** (or from the system for the first board). Each board will present it's
** ExpansionRom structure at location $00E80000 to be read by the system.
** This file defines the appearance of the ExpansionRom area.
**
** Expansion boards are actually organized such that only one nybble per
** 16 bit word contains valid information. The low nybbles of each
** word are combined to fill the structure below. (This table is structured
** as LOGICAL information. This means that it never corresponds exactly
** with a physical implementation.)
**
** The ExpansionRom space is further split into two regions: The first 16
** bytes are read-only. Except for the ertype field, this area is inverted
** by the system software when read in. The second 16 bytes contain the
** control portion, where all read/write registers are located.
**
** The system builds one "ConfigDev" structure for each board found. The
** list of boards can be examined using the expansion.library/FindConfigDev
** function.
**
** A special "hacker" Manufacturer ID number is reserved for test use:
** 2011 ($7DB). When inverted this will look like $F824.
*)
TYPE
ExpansionRomPtr * = POINTER TO ExpansionRom;
ExpansionRom * = RECORD
type * : SHORTINT; (* Board type, size and flags *)
product * : SHORTINT; (* Product number, assigned by manufacturer *)
flags * : s.SET8; (* Flags *)
reserved03 * : SHORTINT; (* Must be zero ($ff inverted) *)
manufacturer * : e.UWORD; (* Unique ID,ASSIGNED BY COMMODORE-AMIGA! *)
serialNumber * : e.ULONG; (* Available for use by manufacturer *)
initDiagVec * : e.UWORD; (* Offset to optional "DiagArea" structure *)
reserved0c * : SHORTINT;
reserved0d * : SHORTINT;
reserved0e * : SHORTINT;
reserved0f * : SHORTINT;
END; (* ExpansionRom *)
(*
** Note that use of the ecBaseAddress register is tricky. The system
** will actually write twice. First the low order nybble is written
** to the ecBaseAddress register+2 (D15-D12). Then the entire byte is
** written to ecBaseAddress (D15-D8). This allows writing of a byte-wide
** address to nybble size registers.
*)
TYPE
ExpansionControlPtr * = POINTER TO ExpansionControl;
ExpansionControl * = RECORD
interrupt * : SHORTINT; (* Optional interrupt control register *)
z3HighBase * : SHORTINT; (* Zorro III : Config address bits 24-31 *)
baseAddress * : SHORTINT; (* Zorro II/III: Config address bits 16-23 *)
shutup * : SHORTINT; (* The system writes here to shut up a board *)
reserved14 * : SHORTINT;
reserved15 * : SHORTINT;
reserved16 * : SHORTINT;
reserved17 * : SHORTINT;
reserved18 * : SHORTINT;
reserved19 * : SHORTINT;
reserved1a * : SHORTINT;
reserved1b * : SHORTINT;
reserved1c * : SHORTINT;
reserved1d * : SHORTINT;
reserved1e * : SHORTINT;
reserved1f * : SHORTINT;
END; (* ExpansionControl *)
(*
** many of the constants below consist of a triplet of equivalent
** definitions: xxMASK is a bit mask of those bits that matter.
** xxBIT is the starting bit number of the field. xxSIZE is the
** number of bits that make up the definition. This method is
** used when the field is larger than one bit.
**
** If the field is only one bit wide then the xxBxx and xxFxx convention
** is used (xxBxx is the bit number, and xxFxx is mask of the bit).
*)
CONST
(* manifest constants *)
slotSize * = 10000H;
slotMask * = 0FFFFH;
slotShift * = 16;
(* these define the free regions of Zorro memory space.
** THESE MAY WELL CHANGE FOR FUTURE PRODUCTS!
*)
eExpansionBase * = 00E80000H; (* Zorro II config address *)
eZ3ExpansionBase * = 0FF000000H; (* Zorro III config address *)
eExpansionSize * = 00080000H; (* Zorro II I/O type cards *)
eExpansionSlots * = 8;
eMemoryBase * = 00200000H; (* Zorro II 8MB space *)
eMemorySize * = 00800000H;
eMemorySlots * = 128;
eZ3ConfigArea * = 40000000H; (* Zorro III space *)
eZ3ConfigAreaEnd * = 7FFFFFFFH; (* Zorro III space *)
eZ3SizeGranularity * = 00080000H; (* 512K increments *)
(**** erType definitions (ttldcmmm) ***************************************)
CONST
(* erType board type bits -- the OS ignores "old style" boards *)
ertTypeMask * = -64; (* Bits 7-6 *)
ertTypeBit * = 6;
ertTypeSize * = 2;
ertNewBoard * = -64;
ertZorroII * = ertNewBoard;
ertZorroIII * = -128;
(* other bits defined in erType *)
ertbMemList * = 5; (* Link RAM into free memory list *)
ertbDiagValid * = 4; (* ROM vector is valid *)
ertbChainedConfig * = 3; (* Next config is part of the same card *)
ertfMemList * = 20H;
ertfDiagValid * = 10H;
ertfChainedConfig * = 08H;
(* erType field memory size bits *)
ertMemMask * = 07H; (* Bits 2-0 *)
ertMemBit * = 0;
ertMemSize * = 3;
(**** erFlags byte -- for those things that didn't fit into the type byte ****)
(**** the hardware stores this byte in inverted form ****)
CONST
erffMemSpace * = -128; (* Wants to be in 8 meg space. *)
erfbMemSpace * = 7; (* (NOT IMPLEMENTED) *)
erffNoShutUp * = 64; (* Board can't be shut up *)
erfbNOShutUP * = 6;
erffExtended * = 32; (* Zorro III: Use extended size table *)
erfbExtended * = 5; (* for bits 0-2 of er_Type *)
(* Zorro II : Must be 0 *)
erffZorroIII * = 16; (* Zorro III: must be 1 *)
erfbZorroIII * = 4; (* Zorro II : must be 0 *)
ertZ3SSMask * = 0FH; (* Bits 3-0. Zorro III Sub-Size. How *)
ertZ3SSBit * = 0; (* much space the card actually uses *)
ertZ3SSSize * = 4; (* (regardless of config granularity) *)
(* Zorro II : must be 0 *)
(* ecInterrupt register (unused) ********************************************)
CONST
ecibINTENA * = 1;
ecibRESET * = 3;
ecibINT2PEND * = 4;
ecibINT6PEND * = 5;
ecibINT7PEND * = 6;
ecibINTERRUPTING * = 7;
ecifINTENA * = 2;
ecifRESET * = 8;
ecifINT2PEND * = 16;
ecifINT6PEND * = 32;
ecifINT7PEND * = 64;
ecifINTERRUPTING * = -128;
(***************************************************************************
**
** these are the specifications for the diagnostic area. If the Diagnostic
** Address Valid bit is set in the Board Type byte (the first byte in
** expansion space) then the Diag Init vector contains a valid offset.
**
** The Diag Init vector is actually a word offset from the base of the
** board. The resulting address points to the base of the DiagArea
** structure. The structure may be physically implemented either four,
** eight, or sixteen bits wide. The code will be copied out into
** ram first before being called.
**
** The daSize field, and both code offsets (daDiagPoint and daBootPoint)
** are offsets from the diag area AFTER it has been copied into ram, and
** "de-nibbleized" (if needed). (In other words, the size is the size of
** the actual information, not how much address space is required to
** store it.)
**
** All bits are encoded with uninverted logic (e.g. 5 volts on the bus
** is a logic one).
**
** If your board is to make use of the boot facility then it must leave
** its config area available even after it has been configured. Your
** boot vector will be called AFTER your board's final address has been
** set.
**
****************************************************************************)
TYPE
DiagAreaPtr * = POINTER TO DiagArea;
DiagArea * = RECORD
config * : e.UBYTE; (* see below for definitions *)
flags * : s.SET8; (* see below for definitions *)
size * : e.UWORD; (* the size (in bytes) of the total diag area *)
diagPoint * : e.UWORD; (* where to start for diagnostics, or zero *)
bootPoint * : e.UWORD; (* where to start for booting *)
name * : e.UWORD; (* offset in diag area where a string *)
(* identifier can be found (or zero if no *)
(* identifier is present). *)
reserved01 * : e.UWORD; (* two words of reserved data. must be zero. *)
reserved02 * : e.UWORD;
END; (* DiagArea *)
(* daConfig definitions *)
(*
** dacByteWide can be simulated using dacNibbleWide.
*)
CONST
dacBusWidth * = 0C0X; (* two bits for bus width *)
dacNibbleWide * = 00X;
dacByteWide * = 40X; (* BUG: Will not work under V34 Kickstart! *)
dacWordWide * = 80X;
dacBootTime * = 30X; (* two bits for when to boot *)
dacNever * = 00X; (* obvious *)
dacConfigTime * = 10X; (* call daBootPoint when first configing *)
(* the device *)
dacBindTime * = 20X; (* run when binding drivers to boards *)
(*
**
** These are the calling conventions for the diagnostic callback
** (from daDiagPoint):
**
** A7 -- points to at least 2K of stack
** A6 -- ExecBase
** A5 -- ExpansionBase
** A3 -- your board's ConfigDev structure
** A2 -- Base of diag/init area that was copied
** A0 -- Base of your board
**
** Your board must return a value in D0. If this value is NULL, then
** the diag/init area that was copied in will be returned to the free
** memory pool.
*)
(*
** $VER: configvars.h 36.14 (22.4.91)
**
** Software structures used by AutoConfig (tm) boards
*)
(*
** At early system startup time, one ConfigDev structure is created for
** each board found in the system. Software may seach for ConfigDev
** structures by vendor & product ID number. For debugging and diagnostic
** use, the entire list can be accessed. See the expansion.library document
** for more information.
*)
TYPE
ConfigDevPtr * = POINTER TO ConfigDev;
ConfigDev * = RECORD (e.NodeBase)
node * : e.Node;
flags * : s.SET8; (* (read/write) *)
pad : e.UBYTE; (* reserved *)
rom * : ExpansionRom; (* copy of board's expansion ROM *)
boardAddr * : e.APTR; (* where in memory the board was placed *)
boardSize * : e.ULONG; (* size of board in bytes *)
slotAddr : e.UWORD; (* which slot number (PRIVATE) *)
slotSize : e.UWORD; (* number of slots (PRIVATE) *)
driver * : e.APTR; (* pointer to node of driver *)
nextCD * : ConfigDevPtr; (* linked list of drivers to config *)
unused : ARRAY 4 OF e.ULONG; (* for whatever the driver wants *)
END; (* ConfigDev *)
CONST
(* cdFlags *)
cdShutup * = 0; (* this board has been shut up *)
cdConfigMe * = 1; (* this board needs a driver to claim it *)
cdBadMemory * = 2; (* this board contains bad memory *)
(*
** Boards are usually "bound" to software drivers.
** This structure is used by GetCurrentBinding() and SetCurrentBinding()
*)
TYPE
CurrentBindingPtr * = POINTER TO CurrentBinding;
CurrentBinding * = RECORD
configDev * : ConfigDevPtr; (* first configdev in chain *)
fileName * : e.LSTRPTR; (* file name of driver *)
productString * : e.LSTRPTR; (* product # string *)
toolTypes * : e.APTR; (* tooltypes from disk object *)
END; (* CurrentBinding *)
END Config.